
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="admin" />
        <title>Show User</title>
    </head>
    <body>
		<div id="center-column">
			<div class="top-bar">
				<g:link class="button" action="create">ADD NEW</g:link>
				<h1>Show User</h1>
				<div class="breadcrumbs">
					<a class="home" href="${createLinkTo(dir:'')}">Home</a> / 
					<g:link class="list" action="list">User List</g:link> /
					<g:link class="create" action="create">New User</g:link>
				</div>
			</div><br />
			<div class="select-bar-border-no"></div>
	        <div class="body">
	            <div class="dialog">
		            <div class="subdialog">
		            	<h2>User</h2>
						<p>
                            <label for="username">Username:</label>
                            <span id="username">${user.username}</span>
						</p>
						<p>
                            <label for="firstname">Firstname:</label>
                            <span id="firstname">${user.firstname}</span>
						</p>
						<p>
                            <label for="lastname">Lastname:</label>
                            <span id="lastname">${user.lastname}</span>
						</p>
						<p>
                            <label for="street">Street:</label>
                            <span id="street">${user?.address?.street}</span>
						</p>
						<p>
                            <label for="city">City:</label>
                            <span id="city">${user?.address?.zipcode}&nbsp;${user?.address?.city}</span>
						</p>
						<p>
                            <label for="createdAt">Created At:</label>
                            <span id="createdAt">
                            	<g:formatDate format="dd.MM.yyyy HH:mm" date="${user.createdAt}"/>
                            </span>
						</p>
		            </div>
                    <div class="subdialog">
                        <h2>Image</h2>
                        <g:displayImage filename="${user.imagename}" user="${user.username}" />
                    </div>
                </div>
	            <div class="dialog">
		            <div class="subdialog">
		            	<h2>Contact Data</h2>
		                <table>
		                    <thead>
		                        <tr>
		                   	        <g:sortableColumn property="type" title="Type" />
		                   	        <g:sortableColumn property="data" title="Data" />
		                        </tr>
		                    </thead>
		                    <tbody>
		                    <g:each in="${user.contactData}" status="i" var="contactData">
		                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
		                            <td>${contactData.type?.encodeAsHTML()}</td>
		                            <td>${contactData.data?.encodeAsHTML()}</td>
		                        </tr>
		                    </g:each>
		                    </tbody>
		                </table>
	                </div>
		            <div class="subdialog">
		            	<h2>Groups</h2>
		                <table>
		                    <thead>
		                        <tr>
		                   	        <g:sortableColumn property="name" title="Group" />
		                        </tr>
		                    </thead>
		                    <tbody>
	                        <g:each in="${user.groups}" status="i" var="group">
								<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
	                         		<td><g:link controller="group" action="show" id="${group.id}">${group.name?.encodeAsHTML()}</g:link></td>
	                            </tr>
	                        </g:each>
		                    </tbody>
		                </table>
		            </div>
	            </div>
	            <div class="buttons" style="clear:both">
	                <g:form controller="user">
	                    <input type="hidden" name="id" value="${user?.id}" />
	                    <span class="button"><g:actionSubmit class="edit" value="Edit" /></span>
	                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
	                </g:form>
	            </div>
	        </div>
	    </div>    
		<div id="right-column">
            <g:if test="${flash.message}">
				<strong class="h">INFO</strong>
	            <div class="box">${flash.message}</div>
            </g:if>
		</div>
    </body>
</html>
